/**复用在MongoDB中的数据结构 */
//引用依赖
const mongoose = require('mongoose');
//连接数据库
mongoose.connect('mongodb://localhost:27017/h51807',function(err){
    if(err){
        
        console.log("连接数据库失败");
        throw err;

    }else{
        console.log("连接数据库成功")
    }
})
//生成Schema
const userSchema = new mongoose.Schema({
    username:String,
    password:String,
    email:String
})
//职位Schema
const positionSchema = new mongoose.Schema({
    company:String,
    salary:Number,
    position:String,
    address:String,
    logo:String
})
//生成Model
//用户
const User = mongoose.model('user',userSchema);
//职位Model
const Position = mongoose.model('position',positionSchema);

//定义模块:导出模块
module.exports={User,Position};